import minRequest from '@/utils/request'

// 根据字典类型查询字典数据信息
export async function getDicts(dictType) {
  const { data }: any = await minRequest.get('/system/dict/data/type/' + dictType)
  const map = data.reduce((pre, curr) => {
    pre[curr.dictValue] = curr.dictLabel
    return pre
  }, {})
  return {
    map,
    data: data.map((item) => ({ label: item.dictLabel, value: item.dictValue })),
  }
}
